import { Component, OnInit } from '@angular/core';
import {BasicService} from "../../unit/basic-service";
import {ActivatedRoute} from "@angular/router";
import {PublishItem} from "../../modals/basic.modal";

@Component({
  selector: 'app-new-detail',
  templateUrl: './new-detail.page.html',
  styleUrls: ['./new-detail.page.scss'],
})
export class NewDetailPage implements OnInit {
  currentData: PublishItem;
  constructor(
      private basicService: BasicService,
      private activateInfo: ActivatedRoute,
  ) { }

  ngOnInit() {
    this.activateInfo.queryParamMap.subscribe((res: any) => {
      if (res?.params?.id) {
        this.getNews(res.params.id);
      }
    });
  }

  getNews(id) {
    this.basicService.getData(`appMessage/get`,{id}).subscribe(res => {
      this.currentData = res;
    });
  }

}
